package com.jason.www.state_pattern.demo1;


import com.jason.www.state_pattern.demo1.context.RoomContext;

public class RoomTest {

    public static void main(String[] args) {
        //有2间房
        RoomContext[] rooms = new RoomContext[2];
        //初始化
        for(int i = 0 ; i < rooms.length ; i++){
            rooms[i] = new RoomContext();
        }

        //正常操作  预定 入住  退房
        System.out.println("--------房间一---------");
        rooms[0].bookRoom();
        rooms[0].checkInRoom();
        rooms[0].checkOutRoom();


        //预定 退订
        System.out.println("--------房间二---------");
        //rooms[1].checkInRoom();                   //不正常操作
        rooms[1].bookRoom();
        rooms[1].unsubscribeRoom();
    }
}
